//
//  CommentItemCell.m
//  Cycling
//
//  Created by 迟国强 on 2023/4/5.
//

#import "CommentItemCell.h"
#import "RouteDetailModel.h"

@implementation CommentItemCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.userIconL.layer.cornerRadius = 26;
    self.userIconL.layer.masksToBounds = YES;
    // Initialization code
}

- (void)setModel:(RouteCommentModel *)model {
    _model = model;
    [self.userIconL sd_setImageWithURL:[NSURL URLWithString:model.user[@"avatar"]] placeholderImage:[UIImage imageNamed:@"icon_mine_head"]];
    self.userNameL.text = model.user[@"name"];
    self.commentTimeL.text = model.createtime;
    self.commentContentL.text = model.content;
    if (model.isSuper) {
        self.commentBtn.hidden = NO;
        self.backgroundColor = UIColor.whiteColor;
        if ([model.recnum intValue] <=3) {
            self.commentNumBtn.hidden = YES;
        } else {
            self.commentNumBtn.hidden = NO;
        }
    } else {
        self.commentNumBtn.hidden = YES;
        self.commentBtn.hidden = YES;
        self.backgroundColor = rgb(240, 240, 240);

    }
}

- (IBAction)numClicked:(UIButton *)sender {
    self.numBlock(self.model);
}
- (IBAction)commentBtnClicked:(UIButton *)sender {
    self.block(self.model);
}

@end
